new Vue({
    el:"#login",
    template:"<div><hr />" +
        "账号：<input id='username' type='text' v-model='username' /><br />" +
        "密码：<input id='password' type='password' v-model='password' /><br />" +
        "<a href='#' @click.prevent='login'>登录</a>" +
        "</div>",
    data: {
        username: "李四",
        password: "123456",
        info: null
    },
    methods:{
        login(){
            var url = "http://localhost:9898/api/user/login";
            let loginData = {username:this.username,password:this.password};
            axios.post(url,Qs.stringify(loginData),{
                header:{
                    'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
            }
        })
                .then(function(response){
                    alert(response.data.message);
                })
                .catch(function(error){
                    console.log(error);
                });
        }
    }
});
